#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#include <string.h>

#define ASSERT_ABORT(expr, msg)         \
	if (!(expr))                        \
	{                                   \
		fprintf(stderr, "%s\n", (msg)); \
		system("pause");                \
		while (getchar() != '\n')       \
			;                           \
		return false;                  \
	}
#define ASSERT_RETRY(expr, msg, jump_out) \
	if (!(expr))                          \
	{                                     \
		fprintf(stderr, "%s\n", (msg));   \
		system("pause");                  \
		while (getchar() != '\n')         \
			;                             \
		if (jump_out)                     \
			break;                        \
		else                              \
			continue;                     \
	}
#define CHOICE_VALID(expr) ASSERT_ABORT(expr, "无效选项")

enum
{
	PLATE_SIZE = 100,
	DATE_SIZE = 20
};

extern int capacity;
extern int price_per_hour;

struct __car__ {
	char name[PLATE_SIZE];
	time_t startTime;
	struct __car__* next;
};
typedef struct __car__ Car;

struct stack {
	Car* top;
	int count;
}parking_lot, temp_parking_lot;

struct queue {
	Car* first;
	Car* last;
	int count;
}lane;

typedef struct stack parking;


Car* leave(char* name);



Car* new_car(void);

Car* pop(struct stack* s);
bool push(struct stack* s, Car* p_car);

int enque(Car* p);
Car* deque(void);


time_t parse_stdin();
void timeParked(time_t t);
void showTimeStamp(time_t t);